package Pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

//首页
public class HomePage extends LoginPage {

    public HomePage goGuestPage(){
        //成功登录
        success();
        //点击访客管理
        driver.findElement(By.xpath("//span[contains(.,'访客管理')]")).click();
        //延时几秒确保页面加载完毕
        waitForWindow(2000);
        return this;
    }

    public HomePage goSupervisorPage(){
        //成功登录
        success();
        //点击督导管理
        driver.findElement(By.xpath("//span[contains(.,'督导管理')]")).click();
        //延时几秒确保页面加载完毕
        waitForWindow(2000);
        return this;
    }

    public HomePage goConsultantPage(){
        //成功登录
        success();
        //点击咨询师管理
        driver.findElement(By.xpath("//span[contains(.,'咨询师管理')]")).click();
        //延时几秒确保页面加载完毕
        waitForWindow(2000);
        return this;
    }

    public HomePage goSchedulePage(){
        //成功登录
        success();
        //点击排班表
        driver.findElement(By.xpath("//span[contains(.,'排班表')]")).click();
        //延时几秒确保页面加载完毕
        waitForWindow(2000);
        return this;
    }
    public HomePage exit() {
        driver.findElement(By.cssSelector(".userMenuBar")).click();
        waitForWindow(1000);
        driver.findElement(By.cssSelector(" .menuActionItem > span:nth-child(2)")).click();
        return this;
    }


        public String dialog(){
        waitForWindow(2000);
        WebElement elementText = driver.findElement(By.cssSelector("div.el-message-box__message"));
        String text = elementText.getText();
        System.out.println(text);
        return text;
    }
}
